package com.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.common.utils.base.UuidUtil;
import com.entity.Column;
import com.repository.ColumnDao;
import com.service.base.BaseServiceImp;

@Service("ColumnService")
public class ColumnServiceImpl extends BaseServiceImp<Column> implements ColumnService{

	@Autowired
	private ColumnDao colDao;
	
	@Override
	public String insert(Column o) {
		o.setId(UuidUtil.get32UUID());
		baseDao.insert(o);
		return o.getId();
	}

	@Override
	@Transactional
	public List<Column> findLower(Column col) {
		List<Column> cols = colDao.find(col);
		return cols;
	}

	@Override
	public List<Column> findUpper(Column col) {
		List<Column> cols =  colDao.findUpper(col);
		return cols;
	}

	@Override
	public List<Column> findNews(Column col) {
		col.setHigherColumnId("01");
		return colDao.find(col);
	}
	
}
